package org.elanfox.intellicommunity.msg.ienum;

import org.elanfox.intellicommunity.common.ienum.base.CodeDescCommonEnum;

/**
 * 点对点命令
 *
 * @author allan
 * @version 1.0.0
 * @date 2020/3/13
 */
public interface CmdEnums {
    enum Type {
        /**
         * 常规命令
         */
        NORMAL,
        /**
         * 设置命令
         */
        SET,
        /**
         * 控制命令
         */
        CONTROL,
        /**
         * 查询命令
         */
        QUERY;
    }

    enum Code implements CodeDescCommonEnum {
        /**
         * 清楚标签数据
         */
        CLEAR_TAG("03", "清楚标签数据", Type.NORMAL),
        /**
         * 心跳
         */
        HEART_BEAT("05", "心跳", Type.NORMAL),
        /**
         * 时间校验
         */
        TIME_VERIFY("06", "时间校验", Type.NORMAL),
        /**
         * 获取标签数据
         */
        GET_TAG("07", "获取标签数据", Type.NORMAL),
        /**
         * 上传标签数据
         */
        UPLOAD_TAG("08", "上传标签数据", Type.NORMAL),
        NAME("41", "设置设备名称", Type.SET),
        NET("42", "设置设备网络参数", Type.SET),
        NET_COMMUNICATION("43", "设置设备网络通信参数", Type.SET),
        LF_SCOPE("48", "设置低频参数", Type.SET),
        RSSI_FILTER("49", "设置433M的RSSI过滤功能", Type.SET),
        BUZZER_STATUS("4B", "设置设备蜂鸣器状态", Type.SET),
        DEVICE_ADDR("51", "设置设备地址", Type.SET),
        FILTER_WAITING_TIME("53", "设置设备过滤等待时间", Type.SET),
        REBOOT("91", "设备重启", Type.CONTROL);


        private String code;
        private String desc;
        private Type type;

        Code(String code, String desc, Type type) {
            this.code = code;
            this.desc = desc;
            this.type = type;
        }

        @Override
        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        @Override
        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public Type getType() {
            return type;
        }

        public void setType(Type type) {
            this.type = type;
        }
    }

    enum SetResult implements CodeDescCommonEnum {
        SUCCESS("00", "设置成功"),
        CMD_CODE_ILLEGAL("01", "命令代码非法"),
        PARAM_VALUE_ILLEGAL("02", "参数值不合法"),
        HANDLE_ERROR("03", "处理该命令时遇到错误");

        private String code;
        private String desc;

        SetResult(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        @Override
        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        @Override
        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 指令状态
     */
    enum Status implements CodeDescCommonEnum {
        IN_EXECUTION(0, "执行中"),
        FAILED(1, "执行失败"),
        HANDLE_SUCCESS(2, "处理成功");


        private Integer code;
        private String desc;

        Status(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        @Override
        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        @Override
        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
}
